
AC_DEFUN([AC_CHECK_TANAL_HEADERS], [
# check for postgres

AC_MSG_CHECKING([how how to find tana headers to build supporting modules])
# check for tanal
AC_ARG_WITH(tanal-root,
	[	--with-tanal-root=DIR  tanal tree located in DIR],
	TANAL_ROOT="$withval",
	TANAL_ROOT=)

AC_MSG_CHECKING([how to link tanal])

# this should be changed to 'include' later
NORMAL_INCLUDE_DIR=anal
if test ".${TANAL_ROOT}" != . ; then
	if test ! -f "${TANAL_ROOT}/$NORMAL_INCLUDE_DIR/anal.h" ; then
		AC_MSG_ERROR(["could not find "${TANAL_ROOT}/$NORMAL_INCLUDE_DIR/anal.h"])
	fi
   TANAL_ROOT=`cd ${TANAL_ROOT} && pwd`
else
	for i in ../ /usr/local /usr /; do
		if test -f "$i/$NORMAL_INCLUDE_DIR/anal.h" ; then
			TANAL_ROOT=`cd $i && pwd`
			break
		fi
		if test x$TANAL_ROOT != x; then
			break
		fi
	done
	if test ".$TANAL_ROOT" = "." ; then
		AC_MSG_ERROR(["could not find tanal - need to install anal.h maybe in libtanal-dev"])
	fi
fi
#if test "$TANAL_ROOT" = "/" -o "$TANAL_ROOT" = "/usr"; then
#	LIBS="${LIBS} -l$LIBNAME"
#else
#	LIBS="${LIBS} -L$TANAL_ROOT/lib -l$LIBNAME"
CPPFLAGS="${CPPFLAGS} -I$TANAL_ROOT/$NORMAL_INCLUDE_DIR"
#fi
AC_MSG_RESULT([TANAL_ROOT is $TANAL_ROOT])
])

